﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using RpgLibrary.CharacterClasses;
using XRpgLibrary.SpriteClasses;
using XRpgLibrary.ItemClasses;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using XRpgLibrary.CharacterClasses;

namespace RpgLibrary.CharacterClasses
{
    public class CharacterData : IRpgDataObject
    {
        #region Field Region
        
        public EntityData Entity;
        public AnimatedSpriteData Sprite;
        public List<EventScript> Scripts;
        public bool PassThrough;
        public bool RespectPassability;

        // Armor fields
        public GameItemData head;
        public GameItemData body;
        public GameItemData hands;
        public GameItemData feet;

        // Weapon/Shield fields
        public GameItemData mainHand;
        public GameItemData offHand;
        public int handsFree;

        #endregion
        
        public string Name
        {
            get { return Entity.Name; }
            set { Entity.Name = value; }
        }
        
        #region Constructor Region

        public CharacterData()
        {
            this.Entity = new EntityData();
        }

        public CharacterData(EntityData entity, AnimatedSpriteData sprite)
        {
            this.Entity = entity;
            this.Sprite = sprite;
        }


        public CharacterData(EntityData entity, AnimatedSpriteData sprite, List<EventScript> scripts, bool passThrough, bool respectPassability)
        {
            this.Entity = entity;
            this.Sprite = sprite;
            this.Scripts = scripts;
            this.PassThrough = passThrough;
            this.RespectPassability = respectPassability;
        }
        

        #endregion
 
        public override string ToString()
        {
            return Name;
        }

        public object Clone()
        {
            CharacterData data = new CharacterData();

            data.Entity = this.Entity;
            data.Sprite = this.Sprite;
            data.PassThrough = this.PassThrough;
            data.RespectPassability = this.RespectPassability;
            data.head = this.head;
            data.body = this.body;
            data.hands = this.hands;
            data.feet = this.feet;

            data.mainHand = this.mainHand;
            data.offHand = this.offHand;
            
            return data;
        }
    }
}